package com.shangcheng.dubbo.api;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shangcheng.dubbo.mappers.SmsFlashPromotionSessionMapper;
import com.shangcheng.model.domain.SmsFlashPromotionSession;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SmsFlashPromotionSessionApiImpl implements SmsFlashPromotionSessionApi {

    @Autowired
    private SmsFlashPromotionSessionMapper smsFlashPromotionSessionMapper;


    /**
     * 添加场次
     *
     * @param smsFlashPromotionSession
     */
    @Override
    public void save(SmsFlashPromotionSession smsFlashPromotionSession) {
        smsFlashPromotionSessionMapper.insert(smsFlashPromotionSession);
    }

    /**
     * 根据id查找数据
     *
     * @param id
     */
    @Override
    public void delete(Integer id) {
        smsFlashPromotionSessionMapper.deleteById(id);
    }

    /**
     * 修改场次
     *
     * @param smsFlashPromotionSession
     */
    @Override
    public void update(SmsFlashPromotionSession smsFlashPromotionSession) {
        smsFlashPromotionSessionMapper.updateById(smsFlashPromotionSession);
    }

    /**
     * 通过id进行查找
     *
     * @param id
     * @return
     */
    @Override
    public SmsFlashPromotionSession findById(Integer id) {
        return smsFlashPromotionSessionMapper.selectById(id);
    }

    /**
     * 获取全部场次
     *
     * @return
     */
    @Override
    public List<SmsFlashPromotionSession> findAll() {
        return smsFlashPromotionSessionMapper.selectList(null);
    }
}
